import {defineEventHandler} from "h3";
import fs from 'fs';
type MdFile = {
    name: string,
    content?: string
};

export default defineEventHandler(async (event) => {
    let params: MdFile = getQuery(event);
    try {
        fs.writeFileSync(`${process.cwd()}/public/mds/${params.name}.md`, params.content??'');
        return {
            msg: '添加成功'
        }
    } catch (e) {
        return e;
    }
})
